package com.alibaba.citrus.ots.sales.plan.functions.planstrategy;

import com.alibaba.citrus.ots.common.util.SpringContextUtil;
import com.alibaba.citrus.ots.sales.plan.repository.SalesPlanStrategyDetailRepository;
import com.alibaba.citrus.ots.sales.plan.sdo.SalesPlanStrategyDetailSDO;
import lombok.Getter;
import lombok.Setter;

/**
 * @description: 计划回复策略详情
 * @DATE 2021/10/15 19:34
 */
public class SalesPlanStrategyDetailEntity {

    @Getter
    @Setter
    private SalesPlanStrategyDetailSDO salesPlanStrategyDetailSDO;

    private static SalesPlanStrategyDetailRepository salesPlanStrategyDetailRepository;

    static {
        salesPlanStrategyDetailRepository = SpringContextUtil.getBean(SalesPlanStrategyDetailRepository.class);
    }

    public static SalesPlanStrategyDetailEntity of(SalesPlanStrategyDetailSDO sdo) {
        SalesPlanStrategyDetailEntity entity = new SalesPlanStrategyDetailEntity();
        entity.setSalesPlanStrategyDetailSDO(sdo);
        return entity;
    }

    public String createSalesPlanStrategy() {
        return salesPlanStrategyDetailRepository.createSalesPlanStrategyDetail(this.salesPlanStrategyDetailSDO);
    }

    public Boolean edit() {
        return salesPlanStrategyDetailRepository.editSalesPlanDetailStrategy(this.salesPlanStrategyDetailSDO);
    }
}
